import { useState } from "react";

export const useClassDetail = (props) => {

    // 目标日期（在detail组件中展示）
    const [date, setDate] = useState(null);
    // 目标日期中的排班（在detail组件中展示）
    const [events, setEvents] = useState([]);
    const [selectedEvent, setSelectedEvent] = useState(null);

    const onCallback = (query) => {
        typeof props?.callback === 'function' && props.callback(query);
    }

    return {
        date,
        events,
        selectedEvent,
        setDate,
        setEvents,
        setSelectedEvent,
        onCallback,
    }
}
